const App = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    getyhk: {},
    bank_name: '',
    bank_account: '',
    bank_card: ''
  },
  TijiaoSq: function () {
    var bank_name = this.data.bank_name
    if (!bank_name) {
      wx.showModal({
        title: '温馨提示：',
        content: '请输入名称',
        showCancel: false,
        confirmText: '关闭提示',
        success(res) {

        }
      })
      return false
    }
    var bank_account = this.data.bank_account
    if (!bank_account) {
        wx.showModal({
        title: '温馨提示：',
        content: '请输入开户行',
        showCancel: false,
        confirmText: '关闭提示',
        success(res) {

        }
      })
      return false
    }
    var bank_card = this.data.bank_card
    if (!bank_card) {
          wx.showModal({
        title: '温馨提示：',
        content: '请输入卡号',
        showCancel: false,
        confirmText: '关闭提示',
        success(res) {

        }
      })
      return false
    }
    let _this = this;
    App._post_form('withdraw/bindCardInfo', {
      bank_name: bank_name,
      bank_account: bank_account,
      bank_card: bank_card
    }, function (result) {
      wx.showModal({
        title: '温馨提示：',
        content: result.msg,
        showCancel: false,
        confirmText: '关闭提示',
        success(res) {
          wx.navigateBack();
        }
      })
    });
  },
  YhkKhh: function (e) {
    var bank_account = e.detail.value
    this.setData({
      bank_account: bank_account
    })
  },
  YhkKh: function (e) {
    var bank_card = e.detail.value
    this.setData({
      bank_card: bank_card
    })
  },
  YhkName: function (e) {
    var bank_name = e.detail.value
    this.setData({
      bank_name: bank_name
    })
  },
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    let _this = this;
    App._post_form('withdraw/getBankInfo', {}, function (result) {
      if (result.msg = 'success') {
        var getyhk = result.data.result
        _this.setData({
          bank_name: getyhk.bank_name,
          bank_account: getyhk.bank_account,
          bank_card: getyhk.bank_card
        })
      }
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})